/*
 * @Author: 王晓崧
 * @Date: 2022-07-06 10:42:11
 * @LastEditTime: 2022-07-07 08:38:32
 * @FilePath: \Client\src\common\router\routes.js
 * @Description: 
 * 
 */
const msgChildren = [
    {
        path: '/likeMsg',
        name: 'LikeMsg',
        component: () => import('@/views/home/msg/likeMsg.vue'),
    },
    {
        path: '/commentMsg',
        name: 'commentMsg',
        component: () => import('@/views/home/msg/commentMsg.vue'),
    },
    {
        path: '/replyMsg',
        name: 'ReplyMsg',
        component: () => import('@/views/home/msg/reply.vue'),
    },
    {
        path: '/chat/:userId',
        name: 'chatwithid',
        component: () => import('@/views/home/msg/chat.vue'),
    },
    {
        path: '/chat',
        name: 'chat',
        component: () => import('@/views/home/msg/chat.vue'),
    },
    {
        path: '/collectMsg',
        name: 'collectMsg',
        component: () => import('@/views/home/msg/collectMsg.vue'),
    },
    {
        path: '/followMsg',
        name: 'followMsg',
        component: () => import('@/views/home/msg/followMsg.vue'),
    },
    {
        path: '/postCheckMsg',
        name: 'PostCheckMsg',
        component: () => import('@/views/home/msg/postCheckMsg.vue'),
    },
    {
        path: '/reportMsg',
        name: 'reportMsg',
        component: () => import('@/views/home/msg/reportMsg.vue'),
    },
]
const barChildren = [
    {
      path: '/home',
      redirect: '/index'
    },
    {
        path: '/postDetail',
        name: 'postDetail',
        component: () => import('@/views/post/postDetail.vue'),
    },
    {
        path: '/searchResult',
        name: 'SearchResult',
        component: () => import('@/views/home/searchResults.vue'),
    },
    {
        path: '/index',
        name: 'Index',
        component: () => import('@/views/home/index.vue'),
    },
    {
        path: '/study',
        name: 'Study',
        component: () => import('@/views/home/study.vue'),
    },
    {
        path: '/food',
        name: 'Food',
        component: () => import('@/views/home/food.vue'),
    },
    {
        path: '/idle',
        name: 'Idle',
        component: () => import('@/views/home/idle.vue'),
    },
    {
        path: '/activity',
        name: 'Activity',
        component: () => import('@/views/home/activity.vue'),
    },
    {
        path: '/fun',
        name: 'Fun',
        component: () => import('@/views/home/fun.vue'),
    },
    {
        path: '/msg',
        name: 'Msg',
        component: () => import('@/views/home/msg.vue'),
        children : msgChildren
    },
    {
        path: '/post',
        name: 'Post',
        component: () => import('@/views/post/post.vue'),
    },
    {
        path: '/bill',
        name: 'Bill',
        component: () => import('@/views/home/bill.vue'),
    },
    {
        path: '/repost',
        name: 'Repost',
        component: () => import('@/views/post/Repost.vue'),
    },

];
const userChildren = [
    {
        path: '/user/:account/all',
        name: 'All',
        component: () => import('@/views/user/userpost.vue'),
    },
    {
        path: '/user/:account/follow',
        name: 'Follow',
        component: () => import('@/views/user/userfollow.vue'),
    },
    {
        path: '/user/:account/collect',
        name: 'Collect',
        component: () => import('@/views/user/usercollect.vue'),
    },
    {
        path: '/user/:account/edit',
        name: 'UserEdit',
        component: () => import('@/views/user/infoch.vue'),
    },
];
const adminChildren = [
    {
        path: '/admin/users',
        name: 'Users',
        component: () => import('@/views/admin/usermanage.vue'),
    },
    {
        path: '/admin/roles',
        name: 'Roles',
        component: () => import('@/views/admin/roles.vue'),
    },
    {
        path: '/admin/labels',
        name: 'Labels',
        component: () => import('@/views/admin/labelmanage.vue'),
    },
    {
        path: '/admin/report',
        name: 'Report',
        component: () => import('@/views/admin/reportmanage.vue'),
    },
    {
        path: '/admin/posts',
        name: 'Posts',
        component: () => import('@/views/admin/postmanage.vue'),
    },
    {
        path: '/admin/judge',
        name: 'Judge',
        component: () => import('@/views/admin/postjudge.vue'),
    },
    {
        path: '/admin/tasks',
        name: 'Tasks',
        component: () => import('@/views/admin/task.vue'),
    },
];
const routes = [

    //访问路由“/”,自动重定向到"/home"
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/login.vue')
    },
    {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/home/home.vue'),
        children: barChildren
    },
    {
        path: '/user/:account',
        name: "User",
        component: () => import('@/views/user/user.vue'),
        children: userChildren
    },
    {
        path: '/admin',
        name: "Admin",
        component: () => import('@/views/admin/admin.vue'),
        children: adminChildren
    },
    {
        path: '/:pathMatch(.*)*', // 其余所有路由推到404
        name: "NotFound",
        component: () => import('@/views/404.vue')
    }

];


export default routes;